//
// Created by Incredible on 17/3/14.
//

#ifndef SELECTIONSORT_STUDENT_H
#define SELECTIONSORT_STUDENT_H

#include <iostream>
#include <string>

using namespace std;

struct Student {
    string name;
    int score;

    //重载操作符 返回bool 为 是否小于
    bool operator<(const Student &otherStudent) {

        //优先使用分数进行排名，分数相同使用姓名字典序排序
        return score != otherStudent.score ? score > otherStudent.score : name < otherStudent.name ;
    }

    //重载输出操作符
    friend ostream &operator<<(ostream &os, const Student &student) {
        os << "Student:" << student.name << " score:" << student.score << endl;
        return os;
    }
};

#endif //SELECTIONSORT_STUDENT_H
